package com.atshiyou.web;

import com.atshiyou.bean.Books;
import com.atshiyou.service.BooksService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class BooksController {

    @Resource
    private BooksService service;
    //匹配请求，调取service方法
    @RequestMapping("/getAllbooks")
    public String getAllBooks(ModelMap map){
        List<Books> booksList = service.getAll();
        map.addAttribute("booklist",booksList);
        return "show";
    }
}
